package lianyz.simpleFX;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class TTMRateListController extends AbstractController {
    private ITTMRateService ttmRateService;
    private String viewName;

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,
                                                 HttpServletResponse response) throws Exception {
        List<TTMRate> ttmRateList = getTtmRateService().getTTMRatesToday();

        ModelAndView modelAndView = new ModelAndView(getViewName());
        modelAndView.addObject("ttmRates", ttmRateList);

        return modelAndView;
    }

    public ITTMRateService getTtmRateService() {
        return ttmRateService;
    }

    public void setTtmRateService(ITTMRateService ttmRateService) {
        this.ttmRateService = ttmRateService;
    }

    public String getViewName() {
        return viewName;
    }

    public void setViewName(String viewName) {
        this.viewName = viewName;
    }
}
